package model.Entity.SIS;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the SIS_DEPTS database table.
 * 
 */
@Entity
@Table(name="SIS_DEPTS")
@NamedQuery(name="Dept.findAll", query="SELECT s FROM Dept s")
public class Dept implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private DeptPK id;

	@Column(name="DEPT_CODE")
	private String deptCode;

	@Column(name="DEPT_NAME")
	private String deptName;

	@Column(name="DEPT_NAME_S")
	private String deptNameS;

	@Temporal(TemporalType.DATE)
	@Column(name="ENTRY_DATE")
	private Date entryDate;

	@Column(name="ENTRY_USER")
	private BigDecimal entryUser;

	@Column(name="MOODLE_CATEGORY")
	private BigDecimal moodleCategory;

	@Column(name="OS_USER")
	private String osUser;

	private String shortcut;

	@Column(name="SHORTCUT_S")
	private String shortcutS;

	private String terminal;

	//bi-directional many-to-one association to SisCours
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dept")
    private List<Course> courseList;

	//bi-directional many-to-one association to SisFaculty
	@ManyToOne(optional=false)
	@JoinColumn(name = "FACULTY_NO", referencedColumnName = "FACULTY_NO", insertable = false, updatable = false)
	private Faculty faculty;

	//bi-directional many-to-one association to SisInstructor
	@ManyToOne
	@JoinColumn(name = "INSTRUCTOR_ID", referencedColumnName = "INSTRUCTOR_ID")
	private Instructor instructor;

	//bi-directional many-to-one association to SisInstructor
    //@OneToMany(mappedBy = "instructorId")
    //private List<Faculty> facultiesList;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dept")
    private List<Instructor> instructorList;

	public Dept() {
	}

	public DeptPK getId() {
		return this.id;
	}

	public void setId(DeptPK id) {
		this.id = id;
	}

	public String getDeptCode() {
		return this.deptCode;
	}

	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}

	public String getDeptName() {
		return this.deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	public String getDeptNameS() {
		return this.deptNameS;
	}

	public void setDeptNameS(String deptNameS) {
		this.deptNameS = deptNameS;
	}

	public Date getEntryDate() {
		return this.entryDate;
	}

	public void setEntryDate(Date entryDate) {
		this.entryDate = entryDate;
	}

	public BigDecimal getEntryUser() {
		return this.entryUser;
	}

	public void setEntryUser(BigDecimal entryUser) {
		this.entryUser = entryUser;
	}

	public BigDecimal getMoodleCategory() {
		return this.moodleCategory;
	}

	public void setMoodleCategory(BigDecimal moodleCategory) {
		this.moodleCategory = moodleCategory;
	}

	public String getOsUser() {
		return this.osUser;
	}

	public void setOsUser(String osUser) {
		this.osUser = osUser;
	}

	public String getShortcut() {
		return this.shortcut;
	}

	public void setShortcut(String shortcut) {
		this.shortcut = shortcut;
	}

	public String getShortcutS() {
		return this.shortcutS;
	}

	public void setShortcutS(String shortcutS) {
		this.shortcutS = shortcutS;
	}

	public String getTerminal() {
		return this.terminal;
	}

	public void setTerminal(String terminal) {
		this.terminal = terminal;
	}

	public List<Course> getCourses() {
		return this.courseList;
	}

	public void setCourses(List<Course> courseList) {
		this.courseList = courseList;
	}

	public Course addCourse(Course course) {
		getCourses().add(course);
		course.setDept(this);

		return course;
	}

	public Course removeCourse(Course course) {
		getCourses().remove(course);
		course.setDept(null);

		return course;
	}

	public Faculty getFaculty() {
		return this.faculty;
	}

	public void setFaculty(Faculty faculty) {
		this.faculty = faculty;
	}

	public Instructor getInstructor() {
		return this.instructor;
	}

	public void setInstructor(Instructor instructor) {
		this.instructor = instructor;
	}

	public List<Instructor> getInstructors() {
		return this.instructorList;
	}

	public void setInstructors(List<Instructor> instructorList) {
		this.instructorList = instructorList;
	}

	public Instructor addInstructor(Instructor instructor) {
		getInstructors().add(instructor);
		instructor.setDept(this);

		return instructor;
	}

	public Instructor removeInstructor(Instructor instructor) {
		getInstructors().remove(instructor);
		instructor.setDept(null);

		return instructor;
	}

	public List<Course> getCourseList() {
		return courseList;
	}

	public void setCourseList(List<Course> courseList) {
		this.courseList = courseList;
	}

	/*
	public List<Faculty> getFacultiesList() {
		return facultiesList;
	}

	public void setFacultiesList(List<Faculty> facultiesList) {
		this.facultiesList = facultiesList;
	}
*/
	public List<Instructor> getInstructorList() {
		return instructorList;
	}

	public void setInstructorList(List<Instructor> instructorList) {
		this.instructorList = instructorList;
	}
	
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dept)) {
            return false;
        }
        Dept other = (Dept) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Dept[ DeptPK=" + id + " ]";
    }

}